using System;
using System.Collections.Generic;
using System.Linq;
using Little_Tower_Defense.Controller;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Little_Tower_Defense.DrawableComponents;

namespace Little_Tower_Defense
{
    /// <summary>
    /// This is the main type for your game.
    /// Creates the first game components and holds all things, that all g ame componends might need.
    /// </summary>
    public class LittleTowerDefense : Microsoft.Xna.Framework.Game
    {
        public readonly int SCREENWIDTH;
        public readonly int SCREENHEIGHT;
        public SpriteBatch SpriteBatch;

        GraphicsDeviceManager graphics;

        public LittleTowerDefense()
        {
            Content.RootDirectory = "Content";

            // Adjust windows size
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferHeight = 768;
            graphics.PreferredBackBufferWidth = 1024;

            SCREENHEIGHT = graphics.PreferredBackBufferHeight;
            SCREENWIDTH = graphics.PreferredBackBufferWidth;

            //Add GameComponents
            Components.Add(new Little_Tower_Defense._DrawableGameComponents.UIElements.VisuallMouse(this));
            Level level = new Level(this, new Rectangle(0, 0, 774, 768));
            Components.Add(level);
            Components.Add(new GUI_UI(this, new Rectangle(0, 0, 250, 768)));
            Components.Add(new Button(this, 800, 100));
            Components.Add(new Little_Tower_Defense.Controller.MouseController(this));
        }

        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();
            //this.IsMouseVisible = true;
        }

        protected override void LoadContent()
        {
            SpriteBatch = new SpriteBatch(GraphicsDevice);

        }

        protected override void UnloadContent()
        {
            // TODO: Unload any non ContentManager content here
        }

        protected override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
        }

        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.LightGreen);

            base.Draw(gameTime);
        }
    }
}
